package com.dly.hope.repository;

import com.dly.hope.modle.Group;
import com.dly.hope.modle.GroupUser;
import com.dly.hope.type.GroupType;
import io.swagger.models.auth.In;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface GroupUserRepository extends JpaRepository<GroupUser, String> {

    List<GroupUser> findAllByGroupIdAndDataStatusAndIsAgree(String groupId, Integer integer, Integer isAgree);

    List<GroupUser> findAllByGroupIdAndDataStatus(String groupId, Integer integer);

    List<GroupUser> findAllByMemberAndDataStatusAndIsAgree(String number, Integer integer, Integer isAgree);

    Optional<GroupUser> findTopByGroupIdAndMemberAndDataStatus(String groupId, String member, Integer status);

    Optional<GroupUser> findTopByGroupIdAndMemberAndDataStatusAndIsAgree(String groupId, String member, Integer status,  Integer isAgree);

    List<GroupUser> findAllByGroupIdInAndDataStatusAndIsAgreeAndGroupType(List<String> groupIds, Integer status, Integer isAgree, GroupType groupType);

    List<GroupUser> findAllByMemberAndDataStatusAndIsAgreeAndGroupType(String member, Integer status, Integer isAgree, GroupType groupType);

    Optional<GroupUser> findByIdAndIsAgreeAndDataStatus(String id, Integer isAgree, Integer status);
}
